home *** CD-ROM | disk | FTP | other *** search
- ┌──────────────────────────────────────────────────────────────────────────┐
- │ │
- │ █ █ █████ ████ ███ █ █ ████ █████ █████ █ │
- │ █ █ █ █ █ █ █ █ ██ █ █ █ █ █ █ █ █ │
- │ █ █ ███ █ █ █ █ █ █ █ █████ ████ ███ █ █ █ │
- │ █ █ █ █ █ █ █ ██ █ █ █ █ █ █ █████ │
- │ █ █████ ████ █ ███ █ █ ████ █████ █ █ █ │
- │ │
- │ by Tumblin / Bodies In Motion │
- └──────────────────────────────────────────────────────────────────────────┘
-
- ████████████████████████████████████████████████████████████████████████████
-
- What's in this doc file anyway?
-
-
- - Introduction to VED v0.4 beta
- - Sample object files
- - How to create your own objects
- - Some chat about the source code
-
-
-
-
-
- ███████████████████████Introduction to VED v0.4 beta████████████████████████
-
- VED v0.4 beta is a little prototype for a vector editor that I am working
- on. At present it is just a text file parser / display program, but
- eventually will become a menu driven, fully graphical vector editor.
- Actually, this is a very late release. I had this thing all programmed like
- five months ago, but lost interest in it because I have been working on the
- newer graphical version of it, which is a total reprogramming of this one.
- This version comes with a collection of object files that you can take a look
- at to help you create some of your very own 3D light source shaded polygon
- objects. The format is very simple and anybody should be able to do it. If
- you've been wanting to make a 3D demo object, but never had the means to,
- then here's your chance!
-
- Here's sytax for the editor:
-
- VED04B filename.ext
-
- I am using the extension .v04 just in case I decide to change the format.
- Wouldn't want the object files getting mixed up with the different versions!
- If you've made any objects with VED v0.3 beta, the file format is exactly the
- same, just rename the files from "filename.V03" to "filename.V04". But this
- version can load with the .V03 extension without a problem. I just like to
- keep things a little organized :-)
-
- The vector object display program (VED04B.EXE) is menu driven and allows
- you to do a few simple things with the object. You can rotate the object on
- the x axis, y axis, z axis, and all three axis at once. You can change the
- position of the light source. You can also increase or decrease the
- distance the object is from the center of the world (0,0,0). The default
- distance is 256. If you design a large object, it is a good idea to increase
- the distance so that the object will fit onto the screen.
-
-
- ████████████████████████████Sample object files█████████████████████████████
-
- Here is a list of the objects that are part of this release:
- (all of them are created by me, Tumblin)
-
-
- 14SIDED V04 - 14 sided prism by Tumblin
- CUBE V04 - simple cube by Tumblin
- CYLINDER V04 - cylinder by Tumblin
- LETTERR V04 - letter "R" by Tumblin
- LETTERT V04 - letter "T" by Tumblin
- PUCK V04 - hockey puck by Tumblin
- PYRAMID V04 - pyramid by Tumblin
- QBINAQB V04 - cube inside a cube by Tumblin
- SPHERE V04 - sphere by Tumblin
- STAR V04 - 6 pointed star by Tumblin
- SWORD V04 - sword by Tumblin
- TRIPIPE V04 - triangular pipe designed by Total Package
- 3DFLAG V04 - Canadian flag by Rush
- CONE V04 - cone by Rush
- DIAMOND V04 - diamond by Rush
- PAPERAIR V04 - paper air plane by Tumblin
-
-
- ████████████████████████How to create your own objects██████████████████████
-
-
- If you think you are ready to start making your own objects, then read on.
-
- First I will explain a little theory of how 3D works. A vector object
- is simply a bunch of points that are placed at specific coordinates on an
- imaginary graph. Those points are then joined together forming the corners
- of polygons. All of the polygons together create the object. If you
- remember the cartesian graph that your math teacher yacked about in high
- school, then you are well on your way. Its the same idea except you have one
- more dimension. You have the vertical & horizontal dimensions, and now a
- depth.
-
- Each 3D point is specified with three numbers in the form of (x,y,z).
-
-
- X is the horizontal dimension (left and right). The center is at 0.
- X grows increasingly negative as you move left, and grows increasingly
- positive as you go to the right. See the number line below:
-
-
- -5 -4 -3 -2 -1 0 1 2 3 4 5
- - <------------------------- -------------------------> +
-
-
- Y is the vertical dimension (up and down). The center is at 0. Y grows
- increasingly negative as you move down, and grows increasingly positive as
- you go up. See number line below:
-
- +
-
- ^
- | 5
- | 4
- | 3
- | 2
- | 1
- 0
- |-1
- |-2
- |-3
- |-4
- |-5
- v
-
- -
-
-
- Z is the depth dimension. The center is at 0 (surface of your monitor).
- Z grows increasingly negative as you go into the screen, and grows
- increasingly positive as you come out of the screen towards your face. See
- number line below:
- -
-
- / -5 <-- inside screen
- / -4
- / -3
- / -2
- / -1
- ................ 0................. <-- screen
- / 1
- / 2
- / 3
- / 4 <-- air infront of screen
- / 5
-
- +
-
- So when you put it all together, you have a graph system that looks like
- this:
-
- up
- (+) (-)(into screen)
-
- | /
- | /
- | /
- | /
- | /
- | /
- left(-) -----------+------------- (+)right
- / |
- / |
- / |
- / |
- / |
- / |
-
- (towards you)(+) (-)
- down
-
-
- To specify a 3D point you simply state its x, y, and z coordinate
- together, like (x,y,z).
-
- The next thing to understand about 3D polygon objects is how to construct
- polygons. Polygons are just multi-sided closed off shapes. In this vector
- editor, there is a restriction, as most polygon systems do, you must make
- sure that the polygons are convex. What this means is that when you draw a
- straight line through any part of a polyon, it can only cut through two
- edges. Any more will make it a concave polygon and will not display properly
- when viewed. A simple way to identify if the polygon is convex is to see if
- all of the vertices (corners where two edges meet) point outward from the
- interior. See the diagram below for an idea of what I mean:
-
-
- ------------\
- / \
- / \ This is a convex polygon.
- / \
- / \ It WILL display correctly.
- / |
- \ | Notice how all the corners point
- \ | outwards.
- \------------------------
-
-
-
- ------------\
- / \
- / \ This is a concave polygon.
- / \
- / \ It will NOT display correctly
- / /----------
- \ / Notice how not all the corners
- \ / point outward.
- \----------/
-
-
- To get around this problem, split the polygon into 2 or more smaller
- polygons, like this:
-
- ------------\
- / - \
- / - \ These are 2 convex polygons joined
- / - \ together to make up a concave one.
- / - \
- - - ----------- It will now display correctly.
- \ /
- \ / Notice how all the corners of each
- \----------/ polygon point outward from its center.
-
-
-
- To be able to draw the polygons, you must list the vertices that you
- want to connect together. Guess what, there is another restriction! The
- vertices must be listed in counter-clockwise order when that particular
- polygon is facing you. If you listed them clockwise, then it will not be
- displayed. This is how the polygon drawing code eliminates non-visible
- surfaces (a.k.a backface removal, or backface culling).
-
- Suppose you wanted to have some polygons that were supposed to be visible
- on both sides instead of just one. How would you get around the restricton
- that a polygon can only have one visible side? Well, what you do is define
- one side of the polygon in counter-clockwise order, then spin the polygon
- around so that the other side is visible and define that in counter-clockwise
- order. So this means that you define the same polygon twice, once for each
- visible side.
-
- Okay, you now know enough to be able to start creating your own objects.
- Let's introduce the file format now. First here are some pointers on what
- is allowed to be in the file:
-
- Comments are allowed on any line in the file. You start the comment
- with the "*" character and it ends with the carriage return (when you press
- the ENTER key). Essentially this is the same idea as comments in a C++
- program. Because the comment goes to the end of the line, you must make sure
- that you don't comment out the required data that you need to make your
- object load correctly. So put them either on their own line, or AFTER all
- the important information is there.
-
- All of the numbers that appear in the file (except for the ones after
- the comment character "*" - they are not used anyway) must be integers. This
- means that they can have a value between -32768 and 32767, including zero.
- All of the numbers must be separated by a character other than a numerical
- digit or a negative sign. I use commas because thats how I was always taught
- to separate items in lists :-) A word of warning!!! You MUST add a
- separation character after the last uncommented number on the line. Remember
- the editor will ignore everything in the comment lines and blank space
- throughout the file. What would happen is the editor would read the last
- number on the line and then stick the first number on the next line to the
- end of the previous line. This makes a big mess and can crash the editor.
-
- Negative numbers should have a negative sign directly infront of the
- number (eg. -5,-123,-30). Positive numbers should not have any symbols
- infront of them at all. (eg. 1,15,66).
-
- The very center of the object is at coordinate 0,0,0. This means that
- all of the rotations are performed using this coordinate as the pivot point.
- Please keep this in mind when creating your objects. If you know what you
- are doing, then you can offset the object a bit and then you can get some
- cool looking whirling effects :-)
-
- Now that you know what is allowed and what is not, here is what must
- appear in the file:
-
- a) the number of vertices in the object
- b) list all the vertices by giving their 3D coordinates x,y,z.
- c) the number of polygons in the object
- d) list all the polygons in the following format:
- i. the number of vertices in the polygon
- ii. list the vertices making the polygon in counter clock wise order
- when visible
- iii. the color of the polygon (not used in VED v0.3 beta, but will
- have a use in later versions to choose a color gradiant range,
- so that you can have multiple light source shading colors to use).
-
-
- The following list shows the light source shading colors available in
- VED v0.4 beta:
-
- 1 = grey (white to dark grey)
- 2 = red (light pink to deep red)
- 3 = yellow (light yellow to tan)
- 4 = blue (light blue to deep blue)
- 5 = purple (light purple to deep purple)
- 6 = green (light green to deep green)
- 7 = brown (tan to dark brown)
-
-
- Thats it! Thats all you need to make an object. A good thing to do is
- to comment EVERYTHING!!!!! I can't stress this enough. When you are listing
- the vertices, put a comment at the end of the line and number them starting
- at zero. This will be necessary when you are ready to start defining your
- polygons. When you are defining your polygons, do step (d) all on the same
- line, and group all the polygons that make a major section of your object.
- This makes "debugging" your object easier.
-
- The following is a sample object that makes a cube:
-
- --------------------------------- cut here ----------------------------------
- * This is an example object for the new VED v0.4b
- * by Tumblin / Bodies In Motion
-
- 8, * number of vertices
-
- * list of vertices
- * format:
- * x,y,z,
- -50,50,-50, * vertex 0 : back top left
- 50,50,-50, * vertex 1 : back top right
- 50,-50,-50, * vertex 2 : back bottom right
- -50,-50,-50, * vertex 3 : back bottom right
- -50,50,50, * vertex 4 : front top left
- 50,50,50, * vertex 5 : front top right
- 50,-50,50, * vertex 6 : front bottom right
- -50,-50,50, * vertex 7 : front bottom left
-
- 6, * number of polygons in object
-
- * polygons for object
- * format:
- * # of polygons, list of vertices, color of polygon
- 4, 0,4,5,1, 1, * top (as viewed from front)
- 4, 7,3,2,6, 2, * bottom
- 4, 0,3,7,4, 3, * left
- 4, 5,6,2,1, 4, * right
- 4, 1,2,3,0, 5, * back
- 4, 4,7,6,5, 6 * front
-
- * all done, end of object :-)
- --------------------------------- cut here ----------------------------------
-
- Note that I don't bother putting a comma after the last relevant number.
- The "6" in this case. Since there are no more numbers to be read in, this
- is okay. Just don't get carried away with it.
-
- Here are some final tips on creating your own cool objects. Start out by
- drawing a sketch of what you want it to look like on some paper. Then try
- to draw a nice, neat LARGE diagram on some graph paper. Label all of your
- vertices starting at zero. For surfaces that you can't see, draw another
- diagram, rotating the object around so that the vertices are visible and keep
- the numbering consistent. This a rather awkward way to design an object
- unless you are good at visualizing things in three dimensions in your head.
- (Thankfully I can do that without a problem 8-). Another tip is when you are
- defining your polygons and listing the vertices making a particular polygon.
- If the polygon is visible that way you have drawn it, the list it in counter-
- clockwise order. If it is not visible, then list it in clockwise order.
- This will help you eliminate re-drawing your diagrams provided they are not
- too complex and you have enough room to draw all the points and label them.
- Its also a good idea to label the axis and even jot down some of the major
- coordinates in the object. Makes things a little easier to visualize.
-
- See VED.REV for information on the revision history of VED.
-
-
- ███████████████████████Some chat about the source code██████████████████████
-
- Just for your information, this stuff was developed using:
- A 486-DX 33MHz computer, Turbo C++ v3.0, TASM v3.1, XLIB v6.1.
-
-
- Alright, here is how to get this thing compiled and running:
-
- 1. Go into the Turbo C++ IDE (I am assuming you are using a Borland C++
- compiler) and load in the ved04b.prj project.
- 2. When you get this far you should make sure that you are using the large
- memory model (try doing an ALT [O]ptions, [C]ompiler, [C]ode generation,
- and then select the large memory model).
- 3. Next you have to make sure that you have the correct directories setup.
- On my system here is what I have done:
- My copy of Turbo C++ is in the c:\tc directory, so what I did was create
- a directory called c:\tc\xlib61 and put all the XLIB 6.1 files in there.
- Then you must make sure that your directories in your IDE take this into
- account. Use the Alt [O]ptions, [D]irectory keys.
- On my system I have them set to these:
- Include directories:
- c:\TC\INCLUDE; C:\TC\XLIB61
- Library directories:
- c:\TC\LIB; C:\TC\XLIB61
- If you are using the Borland C++ 3.1 compiler, for example, then you
- might have to change the TC above to BC, and the rest should be the same
- (hopefully :-).
-
- This makes it very convenient for me to compile and maintain the stuff I
- make with XLIB. For example I can just simply use #include <xlib_all.h>
- at the beginning of my C++ program and don't have to worry about it.
- Oh, by the way, I highly recommend the XLIB graphics library to people
- who are starting out. It is this library that I have been doing most of
- my coding with and find it very useful.
-
- 4. The files that should be in your project file are:
- ved04b.cpp - the main program
- fixedl.asm - the 32-bit fixed point multiply and divide functions
- xlib61l.lib - XLIB v6.1 large memory model library file.
- 5. The files you should have in your current directory (which ever one you
- want to compile VED v0.4 beta in) are:
- ved04b.cpp - the main program
- fixedl.asm - the 32-bit fixed point multiply and divide functions
- ved04clr.h - include file that contains the palette data
- xlib61l.lib - the XLIB v6.1 library file to link with your code
- 6. Then hit F9 (Make) and watch the program compile and link.
- 7. You should be able to run it from your compiler with ALT [R]un, and [R]un.
- Usually I just drop to DOS and test it there because I usually spit out
- text for debugging purposes, but you don't have to if you don't want to.
-
-
- That should get you started. But if not, just email me at:
- m9cl@jupiter.sun.csd.unb.ca
- and I will get back to you as soon as possible.
-
-
- ████████████████████████████████████████████████████████████████████████████
-
-
- signed, Tumblin
-
- P.S. Don't bother emailing me any object files (not that anybody has emailed
- me any objects from the VED v0.3 beta release anyway :-).
- I have the new graphical version of VED v1.0 almost ready. I have also
- created a file convertor so that you can convert these objects to the
- new .V10 format (more info on that when I release it).
-
-